package buckets.core;

import java.io.IOException;
import java.util.List;

import buckets.data.BucketsInstanceContext;
import buckets.data.InstanceContext;
import buckets.strategies.BucketFillingProblemStrategy;
import buckets.strategies.GreedyAlgorithm;

/**
 * This is the core class to all bucket filling problem evaluation tasks.
 * 
 * @author vasek
 *
 */
public class BucketsEvaluator {

	/**
	 * Main method.
	 * 
	 * @param args command line arguments.
	 * @throws IOException when a problem with resource data file occurs 
	 */
	public static void main(final String[] args) throws IOException {
		final InstanceContext context = BucketsInstanceContext.getContext();
		final List<BucketsInstance> instances = context.getInstances();
		
		
		for (BucketsInstance instance : instances) {
			final BucketFillingProblemStrategy strategy = new GreedyAlgorithm(instance);
			
			strategy.run();
			strategy.getNumberOfPassedStates();
			strategy.getResultPath();
			
			System.out.println("Result for id=" + instance.getId() + ", Passed states: " + strategy.getNumberOfPassedStates() + ", Path length: " + strategy.getResultPath().size());
		}
	}

}
